import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/Login.vue'
import Home from '@/views/home/Home.vue'
import HelloWorld from '@/components/HelloWorld.vue'
Vue.use(Router)
export const constantRouterMap = [
    {
        path: '/login',
        component: Login,
        name: '登录页面',
        hidden: true
    },
    {
        path: '',
        component: Home,
        iconCls: 'el-icon-s-flag',
        name: '主页面',
        hidden: false,
        children: xdd()
    },
    {
        path: '/test',
        component: HelloWorld,
        name: '测试页面'
    }
]
export default new Router({
    // mode: 'history', //后端支持可开
    scrollBehavior: () => ({y: 0}),
    mode:'history',
    routes: constantRouterMap
})


export function xdd(){
    console.log("执行了")
    return   [
        { path: '/page1', component: () => import('@/views/home/page/workbench/Page1.vue'), name: 'page1'},
        { path: '/page2', component: () => import('@/views/home/page/workbench/Page2.vue'), name: 'page2'},
        { path: '/page3', component: () => import('@/views/home/page/workbench/Page3.vue'), name: 'page3'}
    ]
}